package tp.pr2;

public class Garbage extends Item {

	/**
	 * 
	 * @param id item id
	 * @param description item desc
	 * @param recycledMaterial the amount of r.m. that the item generates
	 */
	public Garbage(String id, String description, int recycledMaterial) {
		super(id, description);
		this.recycledMaterial = recycledMaterial;
	}

	@Override
	/**
	 * @return true if the item has not been used yet
	 */
	public boolean canBeUsed() {
		return !hasBeenUsed;
	}

	@Override
	/**
	 * @return true if the garbage was transformed in recycled material
	 */
	public boolean use(RobotEngine r, Place p) {
		if (this.hasBeenUsed)
			return false;
		r.addRecycledMaterial(this.recycledMaterial);
		r.sayFuelAndRM();
		hasBeenUsed = true;
		return true;
	}
	
	protected String toStringAppend() {
		return "// recycled material = " + this.recycledMaterial;
	}
	
	
	private boolean hasBeenUsed = false;
	private int recycledMaterial;

}
